package demo1;

/*
//孩子表示法
class Node{
    int val;
    Node left;
    Node right;
}

//孩子双亲表示法
class Node2{
    int val;
    Node left;
    Node right;
    Node parent; //当前节点的根节点
}
*/


public class Test {
    public static void main(String[] args) {
        TreeBinaryTree treeBinaryTree = new TreeBinaryTree();
        TreeBinaryTree.TreeNode   root =  treeBinaryTree.createTree();

        System.out.println("层序遍历" );
        treeBinaryTree.levelOrder(root);

/*        层序遍历
        A B C D E F G H*/


    }
    public static void main1(String[] args) {
        TreeBinaryTree treeBinaryTree = new TreeBinaryTree();
        TreeBinaryTree.TreeNode   root =  treeBinaryTree.createTree();
        System.out.println("----前序遍历----");
        treeBinaryTree.preOrder(root);
        System.out.println();
        System.out.println("----中序遍历----");

        treeBinaryTree.inOrder(root);
        System.out.println();
        System.out.println("----后序遍历----");
        treeBinaryTree.postOrder(root);

        System.out.println();

        System.out.println("节点个数" + treeBinaryTree.size(root));
        System.out.println("叶子节点个数"+treeBinaryTree.getLeafNodeCount(root));

        System.out.println("第k层的节点个数"+treeBinaryTree.getKLevelNodeCount(root,3));
        System.out.println("二叉树的高度"+treeBinaryTree.maxDepth(root));







    }
}
